<template>
    <div class="collect">
      <van-nav-bar
      title="店铺关注"
      left-text="返回"
      right-text="..."
      left-arrow
      @click-left="$router.go(-1)" 
    />
<!-- 收藏列表 -->
      <div class="good" v-for="(item,index) in collectlist" :key="index" @click="$router.push('/detail/'+item.mtWmPoiId)" >
        <div class="good_img">
            <img :src="item.picUrl" alt="">
        </div>
        <div class="good_text">
            <div class="good_content">
                <div class="name">{{item.name}}</div>
                <span>☆{{item.wmPoiScore/10}}</span>&nbsp;<span>{{item.monthSalesTip}}</span>
            </div>
            <div class="good_price">
                <div class="price">
                    <span>{{item.minPriceTip}}</span>&nbsp;<span>{{item.shippingFeeTip}}</span> <span>￥6</span> 
                </div>
                <div class="time">
                    <span>{{item.deliveryTimeTip}}</span> <span>{{item.distance}}</span>
                </div>
            </div>
            <div class="discounts" >
                <div v-for="(a,b) in item.discounts2" :key="b" >{{a.info}}</div>
            </div>
          </div>
        </div>
        <div v-if="collectlist.length == 0" class="empty" >
            <span>您还没有收藏的商家</span><span @click="$router.push('/index')">去逛逛</span>
        </div>
    </div>
</template>

<script>
import { mapState } from 'vuex';
export default {
  computed:{
    ...mapState(['collectlist']),
  },
  methods:{ //d定义方法
    toDetail(item){ //跳转到详情页
      this.$router.push('/detail/'+item.mtWmPoiId);
    }
  },
}
</script>

<style lang="scss" scoped>
  .good{
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
  }
  .good .good_img{
    width: 20%;
    height: 80px;
    margin-left: 10px;
    border: 1px solid #999999;
  }
  .good .good_img img{
    width: 100%;
    height: 100%;
  }
  .good .good_text{
    width: 75%;
    line-height: 20px;
  }
  .good .good_text .name{
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
  }
  .good .good_text .good_content span:nth-child(2){
    font-size: 12px;
    color: red;
  }
  .good .good_text .good_content span:nth-child(3){
    font-size: 12px;
  }
  .good .good_text .good_price{
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding-right: 5px;
    box-sizing: border-box;
  }
  .good .good_text .good_price .time{
    margin-right: 5px;
  }
  .good .good_text .good_price .price span:nth-child(3){
    text-decoration:line-through;
    font-size: 12px;
  }
  .good .good_text .discounts{
    width: 100%;
    display: flex;
    flex-wrap: wrap;
  }
  .good .good_text .discounts div{
    text-align: center;
    color: red;
    border: 1px solid red;
    margin: 10px  10px 0 0 ;
    font-size: 10px;
    padding: 0 5px;
    box-sizing: border-box;
  }
  .empty{
    width: 100%;
    margin-top: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
  }
  .empty span:nth-child(2){
    width: 100px;
    height: 40px;
    background: rgb(13, 167, 245);
    color: white;
    text-align: center;
    line-height: 40px;
    border-radius: 5px;
    margin-top: 10px;
  }

 
</style>